package com.sx.jys.ui.vm

import com.sx.jys.app.net.HttpRequestCoroutine
import com.sx.jys.app.net.bean.FxBeanList
import com.sx.jys.app.until.MutableLiveListData
import com.sx.jys.app.until.request2
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.callback.livedata.BooleanLiveData

class FkVm : BaseViewModel() {
    val fkList = MutableLiveListData<FxBeanList>()
    val hintSuccessEvent = BooleanLiveData()
    val finishRefresh = BooleanLiveData()

    fun reqList() {
        request2({ HttpRequestCoroutine.currList() }, {
            fkList.value = it
            finishRefresh.value = true
        })
    }

    fun reqSettingCur(bean: FxBeanList) {
        request2({ HttpRequestCoroutine.currSet(bean) }, {
            hintSuccessEvent.value=true
            reqList()
        }, isShowDialog = true)
    }
}